package com.gitee.huanminabc.fastboot.orm.base;

import com.gitee.huanminabc.jcommon.container.DataPage;
import com.gitee.huanminabc.jlambda_sql.warapper.LambdaDeleteWrapper;
import com.gitee.huanminabc.jlambda_sql.warapper.LambdaQueryWrapper;
import com.gitee.huanminabc.jlambda_sql.warapper.LambdaUpdateWrapper;
import com.gitee.huanminabc.jlambda_sql.warapper.LambdaWrapper;
import com.gitee.huanminabc.nullchain.NullExt;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * 简要描述
 *
 * @Author: huanmin
 * @Date: 2025/4/5 20:32
 * @Version: 1.0
 * @Description: 文件作用详细描述....
 */
public interface BaseMethodStatement<T extends NullExt<T>> {

    /**
     * 插入一条记录
     *
     * @param entity 实体对象
     */
    boolean insert(T entity);
    boolean insertBatch(List<T> entityList);

    boolean insertOrUpdate(T entity);

    List<T> selectList(LambdaQueryWrapper<T> queryWrapper);

    boolean deleteById(Serializable id);

    /**
     * 根据条件，删除记录
     */
    boolean  delete(LambdaDeleteWrapper<T> deleteWrapper);

    boolean deleteByIds(Collection<?> idList);

    boolean updateById(T entity);

    boolean update(LambdaUpdateWrapper<T> updateWrapper);

    T selectById(Serializable id);

    List<T> selectByIds( Collection<? extends Serializable> idList);

    T selectOne( LambdaQueryWrapper<T> queryWrapper);



    boolean exists(LambdaQueryWrapper<T> queryWrapper);

    long selectCount(LambdaQueryWrapper<T> queryWrapper);

    Map<String, Object> selectMap(LambdaQueryWrapper<T> queryWrapper);

    List<Map<String, Object>> selectMaps(LambdaQueryWrapper<T> queryWrapper);

    <P extends DataPage<T>> P selectPage(int page, int pageSize, LambdaQueryWrapper<T> queryWrapper);

    <P extends DataPage<Map<String, Object>>> P selectMapsPage(int page, int pageSize, LambdaQueryWrapper<T> queryWrapper);


    //=============================================================自定义定制======================================================
    T selectOne( LambdaWrapper<T> queryWrapper);
    List<T> selectList(LambdaWrapper<T> queryWrapper);
    Map<String, Object> selectMap(LambdaWrapper<T> queryWrapper);
    List<Map<String, Object>> selectMaps(LambdaWrapper<T> queryWrapper);
    <P extends DataPage<T>> P selectPage(int page, int pageSize, LambdaWrapper<T> queryWrapper);
    <P extends DataPage<Map<String, Object>>> P selectMapsPage(int page, int pageSize, LambdaWrapper<T> queryWrapper);

    boolean exists(LambdaWrapper<T> queryWrapper);
    long selectCount(LambdaWrapper<T> queryWrapper);

    boolean update(LambdaWrapper<T> updateWrapper);

    boolean  delete(LambdaWrapper<T> deleteWrapper);
}
